package com.zyz.K_集合.Map接口一HashMap.练习;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

/**
 * @author: vick
 * @Date: 2025/3/30
 * @Description:
 * @version: 1.0
 */
public class Demo2 {
    public static Map model = new HashMap();

    static {
        model.put("北京", new String[]{"北京"});
        model.put("上海", new String[]{"上海"});
        model.put("天津", new String[]{"天津"});
        model.put("重庆", new String[]{"重庆"});
        model.put("黑龙江", new String[]{"齐齐哈尔", "哈尔滨", "双鸭山", "大庆"});
        model.put("吉林", new String[]{"长存", "白山", "松原", "白城"});
        model.put("江苏", new String[]{"常州", "镇江", "南京", "苏州","无锡"});
    }
    public static void main(String[] args) {
        Set set = Demo2.model.keySet();
        for (Object obj : set) {
            System.out.print(obj + "\t");
        }
        System.out.println();
        System.out.println("请选择所在省份：");
        Scanner scanner = new Scanner(System.in);
        String province = scanner.next();
        String[] citys = (String[]) Demo2.model.get(province);
        for (String city : citys) {
            System.out.print(city + "\t");
        }
        System.out.println();
        System.out.println("请选择所在城市：");
        String city = scanner.next();
        System.out.println("结束");
    }
}
